﻿Imports System.Xml

Namespace Stories
	Public Class StoryPreference

		Property OpticalMarginAlignment As Boolean

		Property OpticalMarginSize As Double

		Property StoryOrientation As StoryHorizontalOrVertical

		Property StoryDirection As StoryDirectionOptions

		Property FrameType As FrameTypes

		Public Shared Function ReadXml(reader As XmlReader) As StoryPreference
			Dim sp As New StoryPreference()

			sp.OpticalMarginAlignment = CBool(reader.GetAttribute("OpticalMarginAlignment"))
			sp.OpticalMarginSize = Parser.ParseDouble(reader.GetAttribute("OpticalMarginSize"))
			sp.FrameType = [Enum].Parse(GetType(FrameTypes), reader.GetAttribute("FrameType"))
			sp.StoryOrientation = [Enum].Parse(GetType(StoryHorizontalOrVertical), reader.GetAttribute("StoryOrientation"))
			sp.StoryDirection = [Enum].Parse(GetType(StoryDirectionOptions), reader.GetAttribute("StoryDirection"))

			Return sp
		End Function
	End Class
End Namespace